#include "logger.h"
#include <iostream>

//Constructor
logger::logger(char *filename, char *metricsname, string debuglevel) {
	this->debuglevel = debuglevel;
	l_stream.open(filename);
	m_stream.open(metricsname);
}

void logger::debug(string logline, string logdebug) {
	// If for metrics
	if (strcmp(&logdebug[0],"m") == 0) {
		m_stream << logline << endl;;
	}
	if (debuglevel.compare(logdebug)>=0) {
		l_stream << "DEBUG \"" << logdebug << "\": " << logline << endl;
	}
}

//Decstructor
logger::~logger(){
	l_stream.close();
	m_stream.close();
}
